<?php

/**
 * Do the predefined action
 */
function shms_form_action_do(){
  $args = func_get_args();
  $action = $args[0];
  if(!isset($action)){
    drupal_set_message("No Action Defined.","error");
    drupal_goto();
    return; // do nothing if no action
  }
  
  // handles for specific args  | TODO: add authorization check here.
  if($action == 'remove_member'){
    // do the remove member, and then done.
    $pygid = $args[1];
    db_delete(SHMS_PERSON_GROUP_TABLE)->condition('id',$pygid)->execute();
    drupal_set_message("Person has been removed successfully");
  } else if($action == "remove_participants"){
    $pyeid = $args[1];
    db_delete(SHMS_EVENT_ATTENDANCE)->condition('id',$pyeid)->execute();
    drupal_set_message("Person has been removed successfully");
  }
  
  
  else{ // when action undefined
    drupal_set_message("Action Undefined. Please contact the admin for help.",'error');
  }
  drupal_goto();
}

?>